@echo off

if "%~1"=="" (
    echo Usage: %0 [build^|test^|cov]
    exit /b 1
)

setlocal

if "%~1"=="build" (
    echo Building project...
    cjpm build
) else if "%~1"=="test" (
    echo Executing testing...
    cjpm test --coverage --report-path=reports --report-format=xml
) else if "%~1"=="cov" (
    echo Executing coverage report generation, please ensure that the test has been run
    cjcov --root=./ -i src -e src/test --html-details -o reports/cov
) else if "%~1"=="clean" (
    echo Cleaning working directory
    del /s *.gcda *.gcno
    rmdir /s /q build_gcno_output .cache target cov_output
) else (
    echo Invalid argument.
    echo Usage: %0 [build^|test^|cov]
    exit /b 1
)

endlocal